package com.aidansmeaton;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

public abstract class WebViewActivity extends Activity {
	
	protected final Context myApp = this;
	protected String url;
	protected String html;
	protected WebView webview;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.webview);
		
		url = "http://www.google.com"; // default to be overridden by subclass
		html = "";
				
	}
	
	protected abstract void loadWebView();
	
	protected class HTMLWebViewClient extends WebViewClient {
		
		@Override  
	    public void onPageFinished(WebView view, String url)  {
			Toast.makeText(getApplicationContext(), "Page finished", Toast.LENGTH_LONG).show();
			view.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
			
	    }
	}
	
}